<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<style>
    div {
        border: 1px solid red;
        margin-left: 100px;
    }

    p.ex1 {
        margin-left: inherit;
    }
</style>

<body>
    <h1>使用继承值</h1>
    <p>左外边距继承自父元素：</p>
    <div>
        <p class="ex1">本段落继承了 div 元素的左外边距。</p>
    </div>
</body>

</html>